package com.origin.onlinesys.web.controllers.modules.interviewsys;

import com.origin.onlinesys.common.controllers.BaseController;
import com.origin.onlinesys.domain.modules.interviewsys.Education;
import com.origin.onlinesys.service.modules.interviewsys.impl.EducationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2015/1/25 0025.
 * 学历
 */
@Controller
@RequestMapping(value = "/management/education")
public class EducationController extends BaseController{

    @Autowired
    private EducationServiceImpl service;

    @RequestMapping(value = "/findAll")
    public @ResponseBody
    List<Education> findAll(){
        return service.selectAllEdu();
    }

    @RequestMapping(value = "/findByStateY")
    public @ResponseBody
    List<Education> findByStateY(){
        return service.selectByState("1");
    }

    @RequestMapping(value = "/findByStateN")
    public @ResponseBody
    List<Education> findByStateN(){
        return service.selectByState("2");
    }

    @RequestMapping(value = "/add")
    public @ResponseBody
    Education addEdu(@ModelAttribute Education edu){
        return service.insertEdu(edu);
    }

    @RequestMapping(value = "/update")
    public int updateEdu(@ModelAttribute Education edu){
        return service.updateEdu(edu);
    }

    @RequestMapping(value = "/del")
    public @ResponseBody
    String  deleteEdu(String id){
        service.deleteEdu(id);
        return "1";
    }
}

